﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace gamecontrol
{
    public class ScreenRefreshRate
    {
        private double fps;
        DateTime reading = DateTime.Now;

        public void measure()
        {
            DateTime curr = DateTime.Now;
            TimeSpan duration = curr - reading;
            reading = curr;
            fps = duration.TotalMilliseconds;
        }

        public double getRate()
        {
            return fps;
        }

        public bool isValid()
        {
            return fps > 0;
        }
    }
}
